<?php

/* Define Global constants */
define('DOC_ROOT', dirname(__FILE__));
define('ADROIT_PATH', DOC_ROOT . '/adroit/');
$WEB_ROOT = dirname($_SERVER['SCRIPT_NAME']) .'/';
if(file_exists(DOC_ROOT.$WEB_ROOT . 'app/')) {
	define('APP_PATH', DOC_ROOT . $WEB_ROOT . 'app/');
} else {
	define('APP_PATH', DOC_ROOT . '/app/');
}
define('WEB_ROOT', $WEB_ROOT);
define('REAL_ROOT', str_replace('/webroot', '', $WEB_ROOT));
define('TEMPLATE', '.tpl');
define('DS', DIRECTORY_SEPARATOR);

require_once(ADROIT_PATH . 'Adroit.class.php');

/* Database connection values */
$local = array('localhost', 'local', 'host', '10.0.0.215');
if(!isset($_SERVER['SERVER_NAME']) || in_array($_SERVER['SERVER_NAME'], $local)):

Adroit::$config['db']['name'] = 'peak_masterdb';
Adroit::$config['db']['server'] = 'localhost';
Adroit::$config['db']['user'] = 'root';
Adroit::$config['db']['password'] = '';
Adroit::$config['db']['port'] = '3306';

else:

Adroit::$config['db']['name'] = 'peak_masterdb';
Adroit::$config['db']['server'] = 'localhost';
Adroit::$config['db']['user'] = 'peak_user';
Adroit::$config['db']['password'] = 'hithere';
Adroit::$config['db']['port'] = '3306';

endif;

/* Use db to store session instead of file system */
Adroit::$config['sessionDB'] = false;
/* Turn on errors/warnings for debugging */
Adroit::$config['debugging'] = true;

if(!function_exists("seourl")) {
	function seourl($string, $transform=false) {
		if($transform == false) {
			$string = str_replace('-', ' ', $string);
			$string = str_replace('_', '-', $string);
			$string = str_replace('percent', '%', $string);
			$string = str_replace('&amp;', '&', $string);
			$string = str_replace('slash1', '/', $string);
			$string = str_replace('dot', '.', $string);
		    return $string;
		} else {
			$string = strtolower($string);
			$string = str_replace('-', '_', $string);
			$string = str_replace(' ', '-', $string);
			$string = str_replace('%', 'percent', $string);
			$string = str_replace('&', '&amp;', $string);
			$string = str_replace('/', 'slash1', $string);
			$string = str_replace('.', 'dot', $string);
		    return $string;
		}
	}
}
?>